<?php

class Upload{


	public function __construct(){

	}

	public static function uploadFile($fileName,$uploadDir){

		$imagePath = ''; 

		if ($_FILES[$fileName]["name"]!=NULL){

			$image     = $_FILES[$fileName];		     

		    if (trim($image['tmp_name']) != '') {  
		        $ext = substr(strrchr($image['name'], "."), 1);         
		        $imagePath = md5(rand() * time()) . ".$ext";
		        if (!move_uploaded_file($image['tmp_name'], $uploadDir . $imagePath)) {
						$imagePath = '';
				}			
		    }   

		} 
	    return $imagePath;

	}


}


?>